package com.erp.app.common.search.beans;

import java.sql.Connection;
import java.util.ArrayList;

import com.erp.app.common.search.dao.SearchDAO;
import com.erp.framework.model.dao.ServiceLocator;
import com.erp.framework.util.logger.Logger;

public class SearchDelegate implements java.io.Serializable {

    public SearchDelegate() {
    }

    public synchronized ArrayList searchSearch(String query) throws java.sql.SQLException {
        ArrayList rslt = new ArrayList();
        Connection conn = null;
        try {
            conn = ServiceLocator.getInstance().getDSDBConnection();
            SearchDAO dao = new SearchDAO();
            rslt = dao.searchSearch(query, conn);
        } catch (Exception e) {
        	Logger.logExceptions(this, e);
        } finally {
            try {
                if (conn != null)
                    conn.close();
            } catch (Exception e) {
            	Logger.logExceptions(this, e);
            }
        }
        return rslt;
    }
}
